/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.hiddendanger.service.api;

import com.koron.audit.domain.Audit;
import com.koron.common.bean.StaffBean;
import com.koron.common.domain.DataBean;
import com.koron.common.stub.Port;
import com.koron.hazardsource.domain.IndicationItems;
import com.koron.hiddendanger.domain.HiddenDangerDiscovery;
import com.koron.hiddendanger.domain.HiddenDangerRectification;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.koron.ebs.mybatis.SessionFactory;
import org.springframework.web.multipart.MultipartFile;
import org.swan.bean.MessageBean;

import java.io.InputStream;
import java.util.Date;
import java.util.List;

public interface HiddenDangerDiscoveryService {
    /**
     * 保存或提交隐患记录
     * @param user
     * @param dangerDiscovery
     * @param operationType
     * @param delAtts
     * @param keepAtts
     * @param files
     * @param note
     * @param approval
     * @return
     */
    MessageBean<Integer> saveOrCommit(StaffBean user, HiddenDangerDiscovery dangerDiscovery,Integer operationType,
                                      String delAtts,String keepAtts,MultipartFile[] files,String title,String note,String approval) ;


    /**
     * 启动选中的隐患为草稿的流程
     * @param user
     * @param corpCode
     * @param title
     * @param note
     * @param approvalUserid
     * @param hiddenDangerIds
     * @return
     */
    MessageBean<Integer> startDangerWorkFlow(StaffBean user,String corpCode,String title, String note, String approvalUserid, String [] hiddenDangerIds);

    /**
     * 填写隐患整改记录，包含整改延期，整改结果验证
     * @param user
     * @param rectification
     * @param operation 0确认隐患整改人等信息，1填写隐患整改记录，2填写整改延期申请，3处理整改延期申请处理，4整改验证结果
     * @param files
     * @param supervisionUnitFile
     * @return
     */
    MessageBean<Integer> updateDangerRectification(StaffBean user, HiddenDangerRectification rectification, Integer operation, MultipartFile[] files, MultipartFile[] supervisionUnitFile, MultipartFile[] rectificationFile);


    /**
     * 判断是否可以执行流程的提交操作
     * @param user
     * @param audit
     * @param operation 0，确认隐患整改信息判断是否能进入下一审批节点，1填写隐患整改记录/填写隐患整改延期判断是否能进入下一审批节点，2隐患验证判断是否能结束整个流程
     * @return
     */
   MessageBean<Boolean> isAllDealed(StaffBean user, Audit audit, Integer operation);

    MessageBean<Integer> updateState(StaffBean user, String auditId, Boolean cancel);

    /**
     * 根据主键查询隐患记录
     * @param id
     * @return
     */
    MessageBean<HiddenDangerDiscovery> queryDangerOne(String id);

    /**
     * 批量删除隐患记录
     * @param idList
     * @return
     */
    MessageBean<Integer> batchDelete(List<String> idList);

    /**
     * 根据指定条件查询隐患记录列表
     * @return
     */
    MessageBean<DataBean<HiddenDangerDiscovery>> queryDangerByCondition(StaffBean user, String description, String dangerType, String dangerLevel, String corpCode,
                                                                        String gridCode, String checkUnit, Integer state, Date startTime, Date endTime, Integer start, Integer rows, Integer mobile, Integer queryAll,String submitterCode,String keyword);

    /**
     * 根据检查记录id查询某次检查记录填写的隐患记录列表
     * @param checkRecordId
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<HiddenDangerDiscovery>> queryDangerByCheckRecordId(String checkRecordId, Integer start, Integer rows);

    /**
     * 查询临时隐患列表
     * @param start
     * @param rows
     * @return
     */
    MessageBean<DataBean<HiddenDangerDiscovery>> queryTempDanger(Integer start,Integer rows);


    /**
     * 根据隐患id查询整改记录列表
     * @param dangerId
     * @return
     */
    MessageBean<List<HiddenDangerRectification>> queryRectificationByDangerRecordId(String dangerId);

    MessageBean<HiddenDangerRectification> queryOneRectificationById(String rectificationId);


    /**
     * 生成隐患编码
     * @param factory
     * @param dangerDiscovery
     * @return
     */
    String generateCode(SessionFactory factory, HiddenDangerDiscovery dangerDiscovery);

    void getNames(HiddenDangerDiscovery bean);

    Port getPort();
    /**
     * 判断是否为安全管理员
     * @param user
     * @return
     */
    MessageBean<Boolean> isSafetyRole(StaffBean user);

    /**
     * 根据id列表查询隐患列表
     * @param idList
     * @return
     */
    MessageBean<List<HiddenDangerDiscovery>> queryDangerByIdList(List<String> idList);

    /**
     * 导入隐患
     * @param user
     * @param files
     * @return
     */
    MessageBean<String> importImage(StaffBean user,String corpCode,MultipartFile[] files);

    MessageBean<List<HiddenDangerDiscovery>> getAll(StaffBean user, String description, String dangerType, String dangerLevel, String corpCode, String gridCode, String checkUnit, Integer state, Date startTime, Date endTime);

    MessageBean<Integer> update(StaffBean user, String id, String elementFristType, String elementSecondType, String dangerType, String dangerLevel);

    MessageBean<Integer> updateCheckUnit();

    XSSFWorkbook export(StaffBean user, String description, String dangerType, String dangerLevel, String corpCode, String gridCode, String checkUnit, Integer state, Date startTime, Date endTime, InputStream inputStream,String exportIds);

    MessageBean<DataBean<HiddenDangerDiscovery>> homePageDangerList(StaffBean user, String corpCode, String gridCode, String checkUnit, Integer state, Date startTime, Date endTime, Integer start, Integer pageSize);

    MessageBean<String> withdrawWorkFlow(StaffBean user, String id);
}
